#pragma once
#include<iostream>
using namespace std;
#include<cstring>
#include <cstdlib>

//Term类，用于储存操作数和操作符，flag为操作数与操作符判断标志
class Term
{
public:
  Term(int f=0, string s="",double d=0)
    {
      flag = f;
      //flag=1为操作数
      if (flag == 1)
	{
	  Operand = d;
	}
      else
	{
	  Operator = s;
	}
    }
  friend class Terms;

  int flag;
  double Operand;
  string Operator;
};


class Terms
{
 public:
  Terms(Term* T, int s)
    {
      terms = T;
      Size = s;
    }
  void display()
  {
    for (int n = 0; n < Size; n++)
      {
	if (terms[n].flag == 1)
	  {
	    cout << terms[n].Operand << endl;
	  }
	else if (terms[n].flag == 0)
	  {
	    cout << "Error";
	  }
	else
	  {
	    cout << terms[n].Operator << endl;
	  }
      }
  }


  Term* terms;
  int Size;
};
